*** Settings ***
Documentation           通过cli查询所有syslog上报通道
Resource                ../../test_function/cli/ssh.robot
Suite Setup             Open SSH Connection
Suite Teardown          Close SSH Session    ${ssh}

*** Variables ***
${input}                ipmcget -t syslog -d iteminfo
${expected_output}      Item Num

*** Test Cases ***
Get Repoting Channel Via cli
    [Documentation]    通过ssh查询所有syslog上报通道
    [Tags]    Get_Repoting_Channel_Via_cli

    # 增加会话稳定性检查
    Wait Until Keyword Succeeds    3x    2s    Verify SSH Connection    ${ssh}
    
    # 增加命令执行重试机制
    ${rsp}=    Run Keyword And Ignore Error    
    ...    Wait Until Keyword Succeeds    3x    1s    
    ...    Execute SSH Command    ${ssh}    ${input}
    
    # 清理内容
    ${clean_rsp}=    Evaluate    re.sub(r'\\x1b\\[[0-9;]*[a-zA-Z]', '', """${rsp[1]}""")    modules=re
    
    Should Not Be Empty    ${clean_rsp}    msg=未获取BMC版本信息
    Should Match Regexp    ${clean_rsp}    ${expected_output}       msg=未找到产品信息


